apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  name: mote
  labels:
    app: mote
spec:
  replicas: 1
  revisionHistoryLimit: 5
  selector:
    app: mote
  template:
    metadata:
      labels:
        app: mote
    spec:
      containers:
      - image: image-registry.openshift-image-registry.svc:5000/mote/mote
        name: mote
        imagePullPolicy: IfNotPresent
        env:
        - name: REDIS_PASSWORD
          valueFrom:
            secretKeyRef:
              name: redis-password
              key: password
        volumeMounts:
{% if env == 'staging' %}
        - mountPath: /srv/web/meetbot
{% else %}
        - mountPath: /srv
{% endif %}
          name: meetbot
        - mountPath: /opt/app/mote/config.py
          name: mote-config
          readOnly: true
          subPath: config.py
        resources:
          limits:
            cpu: 100m
            memory: 500Mi
          requests:
            cpu: '0'
            memory: 50Mi
        readinessProbe:
          httpGet:
            path: /
            port: 9696
            scheme: HTTP
          initialDelaySeconds: 5
          timeoutSeconds: 1
          periodSeconds: 30
          successThreshold: 1
          failureThreshold: 3
        livenessProbe:
          httpGet:
            path: /
            port: 9696
            scheme: HTTP
          initialDelaySeconds: 5
          timeoutSeconds: 1
          periodSeconds: 30
          successThreshold: 1
          failureThreshold: 3
      volumes:
      - name: meetbot
        persistentVolumeClaim:
          claimName: meetbot-storage
      - configMap:
          defaultMode: 420
          name: mote
        name: mote-config
      restartPolicy: Always
  triggers:
  - type: ConfigChange
  - type: ImageChange
    imageChangeParams:
      automatic: true
      from:
        kind: ImageStreamTag
        name: mote:latest
      containerNames:
      - "mote"
